package 面试.遍历算法.String类型题目;

import java.util.HashSet;
import java.util.Set;

public class 去重倒序 {
    public static void main(String[] args) {
        int num = 9876673;
        Integer integer = num;
        String s = integer.toString();
        Set set = new HashSet();
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = s.length()-1; i >= 0; i--) {
            char c = s.charAt(i);
            if(set.add(c)){
                stringBuilder.append(c);
            }
        }
        System.out.println(stringBuilder);
    }
}
